<?php
	//----------------------- INPUT ELEMENTS -------------------//
	$ssFilter 		= $this->arrParam['ssFilter'];
	$hiddenLanguages = $this->formHidden('lang_code',$ssFilter['lang_code']);
	$selectLanguages = $ssFilter['lang_code'] . $hiddenLanguages;
	$name 			= $this->formText ( 'name', $this->Item['name'], array ('class' => 'txtlong active', 'onchange'=>"get_alias()") );
	$alias 			= $this->formText ( 'alias', $this->Item['alias'], array ('class' => 'txtlong') );
	$picture 		= $this->cmsUserFiles('picture', $this->Item['picture'], 'Chọn ảnh', 'images', $options = array('class' => 'txtfile') ) ;
	$option 		= array('Không','Có');
	if(isset($this->Item['status'])){
		$trangthai = $this->Item['status'];
	}else{
		$trangthai = 1;
	}
	$status 		= $this->formRadio('status',$trangthai,null,$option, ' ');
	
	if(isset($this->Item['order'])){
		$order = $this->Item['order'];
	}else{
		$order = 255;
	}
	$order 			= $this->formText ( 'order', $order, array ('class' => 'short' ) );
	$parents		= $this->cmsSelect('parents',$this->Item['parents'],$this->slbMenu,array('size'=>10,'style'=>'min-width:200px;'));

	$arrInput = array(
				array('label' => 'Chọn ngôn ngữ','input' => $selectLanguages),
				array('label' => 'Tiêu đề','input' => $name),
				array('label' => 'Liên kết tĩnh','input' => $alias),
				array('label' => 'Hình ảnh','input' => $picture),
				array('label' => 'Thuộc danh mục','input' => $parents),
				array('label' => 'Hiển thị','input' => $status),
				array('label' => 'Thứ tự','input' => $order),
			);
	
	//-------------------- SESSAGES ERROR ------------------
	if(count($this->messageError)>0){
		$errors = $this->formErrors($this->messageError,array('id'=>'errors'));
	}
?>
<form name="appForm" method="post" action="" enctype="multipart/form-data">
	<?php echo $this->render('admin-menu/toolbar/index.php');?>
 	<div class="clr"></div>
	<?php echo $this->render('admin-menu/sublink/index.php');?>
	<?php echo $errors;?>

	<!-- BEGIN: CONTENT -->
	<div class="app_content goc10">
		<div class="width-60 fl">
			<fieldset class="adminform">
				<legend>Chi tiết</legend>
				<table class="adminformlist">
					<?php echo $this->partialLoop('row.php', $arrInput);?>
				</table>
			</fieldset>
		</div>
		<div class="width-40 fr">
			<div id="pane-sliders" class="pane-sliders">
				<div class="panel">
					<h3 id="metadata-options" class="title pane-toggler-down"><a href="javascript:void(0);"><span>Metadata Options</span></a></h3>
					<div class="panel_content">
						<fieldset class="panelform">
							<div class="title_option">Chọn kiểu cho menu</div>
							<div class="content_option">
							<?php
								$linkHome = $this->url(array('module'=>'default','controller'=>'admin-menu','action'=>'home'));
								$linkArticle = $this->url(array('module'=>'default','controller'=>'admin-menu','action'=>'article'));
								$linkShopping = $this->url(array('module'=>'default','controller'=>'admin-menu','action'=>'shopping'));
								$linkGallery = $this->url(array('module'=>'default','controller'=>'admin-menu','action'=>'gallery'));
								$linkFaqs = $this->url(array('module'=>'default','controller'=>'admin-menu','action'=>'faqs'));
								
								$linkContact = $this->url(array('module'=>'default','controller'=>'admin-menu','action'=>'contact'));
								$linkSitemap = $this->url(array('module'=>'default','controller'=>'admin-menu','action'=>'sitemap'));
								$linkUrl = $this->url(array('module'=>'default','controller'=>'admin-menu','action'=>'url'));
							?>
								<input type="radio" name="module_options" value="home" onclick="javascript:loadPage('<?php echo $linkHome;?>')" <?php if($this->Item['module_options'] == 'home') echo 'checked="checked"';?>> <span style="padding: 0px 15px 2px 2px;">Trang chủ</span>
								<input type="radio" name="module_options" value="article" onclick="javascript:loadPage('<?php echo $linkArticle;?>')" <?php if($this->Item['module_options'] == 'article') echo 'checked="checked"';?>> <span style="padding: 0px 15px 2px 2px;">Bài viết</span>
								<input type="radio" name="module_options" value="shopping" onclick="javascript:loadPage('<?php echo $linkShopping;?>')" <?php if($this->Item['module_options'] == 'shopping') echo 'checked="checked"';?>> <span style="padding: 0px 15px 2px 2px;">Sản phẩm</span>
								<input type="radio" name="module_options" value="gallery" onclick="javascript:loadPage('<?php echo $linkGallery;?>')" <?php if($this->Item['module_options'] == 'gallery') echo 'checked="checked"';?>> <span style="padding: 0px 15px 2px 2px;">Thư viện ảnh</span>
								<input type="radio" name="module_options" value="contact" onclick="javascript:loadPage('<?php echo $linkContact;?>')" <?php if($this->Item['module_options'] == 'contact') echo 'checked="checked"';?>> <span style="padding: 0px 15px 2px 2px;">Liên hệ</span>
									
								<div style="padding: 4px 0;"></div>
								<input type="radio" name="module_options" value="faqs" onclick="javascript:loadPage('<?php echo $linkFaqs;?>')" <?php if($this->Item['module_options'] == 'faqs') echo 'checked="checked"';?>> <span style="padding: 0px 15px 2px 2px;">Hỏi đáp</span>
								<input type="radio" name="module_options" value="url" onclick="javascript:loadPage('<?php echo $linkUrl;?>')" <?php if($this->Item['module_options'] == 'url') echo 'checked="checked"';?>> <span style="padding: 0px 15px 2px 2px;">Liên kết</span>
							</div>
								
							<div id="content_option"></div>
							<script type="text/javascript">
								<?php
									if(isset($this->Item['module_options'])){
										$linkOptions = $this->url(array(
															'module'=>'default',
															'controller'=>'admin-menu',
															'action'=>$this->Item['module_options'],
															'cat_id'=>$this->Item['cat_id'],
															'target'=>$this->Item['target'],
															'auto_submenu'=>$this->Item['auto_submenu'],
															'url'=>base64_encode($this->Item['url']),
															));
										echo "$('div#content_option').load('" . $linkOptions . "');";
									}
								?>
								function loadPage(url){
									$('div#content_option').html('Đang tải...');
									$('div#content_option').load(url);
									$('div#content_option').removeClass('loading');
								}
							</script>
						</fieldset>
					</div>
				</div>
					
			</div>
		</div>
		<div class="clr"></div>
	</div>
	<!-- END: 	CONTENT -->
</form>